﻿<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:SilverAmp_Converters="clr-namespace:SilverAmp.Converters" xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" x:Class="SilverAmp.Extensions.SongEditExtensionView"
    mc:Ignorable="d"
d:DesignWidth="565" d:DesignHeight="198">
	<UserControl.Resources>
		<SilverAmp_Converters:ExtensionTypeConverter x:Key="ExtensionTypeConverter"/>
		<DataTemplate x:Key="Lookup">
			<Grid Width="50" Height="50">
				<TextBlock Text="{Binding Name}" Margin="0" HorizontalAlignment="Left" VerticalAlignment="Bottom" d:DataContext="{d:DesignData /SampleData/SilverAmpExtensionSampleData.xaml}" TextTrimming="WordEllipsis"/>
				<Image Margin="0" Source="{Binding DisplayIcon}" d:DataContext="{d:DesignData /SampleData/SilverAmpExtensionSampleData.xaml}" Width="45" Height="45"/>
				
			</Grid>
		</DataTemplate>
		<ItemsPanelTemplate x:Key="ItemsPanelTemplate1">
			<toolkit:WrapPanel/>
		</ItemsPanelTemplate>
	</UserControl.Resources>
    <Grid d:DataContext="{d:DesignData /SampleData/SongEditExtensionViewModelSampleData.xaml}">
    	<Grid.RowDefinitions>
    		<RowDefinition Height="103"/>
    		<RowDefinition/>
    	</Grid.RowDefinitions>
        <Grid x:Name="LayoutRoot" d:DataContext="{d:DesignData /SampleData/TrackInfoSampleData.xaml}" 
          DataContext="{Binding Song}" Grid.RowSpan="2">
            <TextBox Text="{Binding Artist, Mode=TwoWay}" Margin="28,23,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Foreground="{StaticResource AlmostWhiteBrush}" Width="204"/>
            <TextBox Text="{Binding Name, Mode=TwoWay}" Margin="236,23,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Foreground="{StaticResource AlmostWhiteBrush}"/>
            <TextBox Text="{Binding Tags.Album, Mode=TwoWay}" Margin="30,59,0,0" HorizontalAlignment="Left" Foreground="{StaticResource AlmostWhiteBrush}" VerticalAlignment="Top" Width="152"/>
            <TextBox Text="{Binding Tags.Track, Mode=TwoWay}" Margin="186,59,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Foreground="{StaticResource AlmostWhiteBrush}" Width="46"/>
            <TextBox Text="{Binding Tags.Year, Mode=TwoWay}" Margin="236,59,114,0" Foreground="{StaticResource AlmostWhiteBrush}" VerticalAlignment="Top"/>
           
        </Grid>
        <ListBox x:Name="listBox" Margin="8" Style="{StaticResource ListBoxDefault}" Background="{x:Null}" 
    		ItemsSource="{Binding ExtensionsModel.Extensions, ConverterParameter=SongInformationLookup, Converter={StaticResource ExtensionTypeConverter}, Mode=TwoWay}"
    		BorderBrush="{x:Null}" Grid.Row="1" 
                 ItemTemplate="{StaticResource Lookup}" 
                 ItemsPanel="{StaticResource ItemsPanelTemplate1}">
            
        	<i:Interaction.Triggers>
        		<i:EventTrigger EventName="SelectionChanged">
        			<i:InvokeCommandAction Command="{Binding UpdateSongInfoCommand}" CommandParameter="{Binding SelectedItem, ElementName=listBox}" />
        		</i:EventTrigger>
        	</i:Interaction.Triggers>
            
        </ListBox>

    </Grid>
</UserControl>
